﻿@using Abp.Application.Services.Dto
@using Abp.Extensions
@using Abp.Timing;
@using Mes5GService.Web.Areas.AppAreaName.Startup
@model Mes5GService.Web.Areas.AppAreaName.Models.HostSettings.HostSettingsViewModel
@{
    ViewBag.CurrentPageName = AppAreaNamePageNames.Host.Settings;
}
<link rel="stylesheet" abp-href="/view-resources/Areas/AppAreaName/Views/Common/_KeyValueListManager.css" asp-append-version="true"/>

@section Scripts
{
    <script>
    var isOpenIdEnabled = @(Model.EnabledSocialLoginSettings.Contains("OpenId") ? "true" : "false");
    var openIdConnectClaimsMappings = @Html.Raw(Model.Settings.ExternalLoginProviderSettings.OpenIdConnectClaimsMapping == null || Model.Settings.ExternalLoginProviderSettings.OpenIdConnectClaimsMapping.Count == 0 ? "[]" : Newtonsoft.Json.JsonConvert.SerializeObject(Model.Settings.ExternalLoginProviderSettings.OpenIdConnectClaimsMapping));
    
    var isWsFederationEnabled = @(Model.EnabledSocialLoginSettings.Contains("WsFederation") ? "true" : "false");
    var wsFederationClaimsMappings = @Html.Raw(Model.Settings.ExternalLoginProviderSettings.WsFederationClaimsMapping == null || Model.Settings.ExternalLoginProviderSettings.WsFederationClaimsMapping.Count == 0 ? "[]" : Newtonsoft.Json.JsonConvert.SerializeObject(Model.Settings.ExternalLoginProviderSettings.WsFederationClaimsMapping));

    </script>
    <script abp-src="/view-resources/Areas/AppAreaName/Views/Common/_KeyValueListManager.js" asp-append-version="true"></script>
    <script abp-src="/view-resources/Areas/AppAreaName/Views/HostSettings/Index.js" asp-append-version="true"></script>
}

<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
<abp-page-subheader title="@L("Settings")" description="@L("SettingsHeaderInfo")">
    <button id="SaveAllSettingsButton" class="btn btn-primary">
        <i class="fa fa-save"></i> @L("SaveAll")
    </button>
</abp-page-subheader>

<div class="@(await GetContainerClass())">
<div class="card card-custom gutter-b">
<div class="card-body">
<div id="SettingsTabPanel">
<ul class="nav nav-tabs" role="tablist">
    @if (Clock.SupportsMultipleTimezone)
    {
        <li class="nav-item">
            <a href="#SettingsGeneralTab" class="nav-link active" data-toggle="tab" role="tab">
                @L("General")
            </a>
        </li>
    }
    <li class="nav-item">
        <a href="#SettingsTenantManagementTab" class="nav-link @((!Clock.SupportsMultipleTimezone) ? "active" : "")" data-toggle="tab" role="tab">
            @L("TenantManagement")
        </a>
    </li>
    <li class="nav-item">
        <a href="#SettingsUserManagementTab" data-toggle="tab" role="tab" class="nav-link">
            @L("UserManagement")
        </a>
    </li>
    <li class="nav-item">
        <a href="#SecurityManagementTab" data-toggle="tab" role="tab" class="nav-link">
            @L("Security")
        </a>
    </li>
    <li class="nav-item">
        <a href="#SettingsEmailSmtpTab" data-toggle="tab" role="tab" class="nav-link">
            @L("EmailSmtp")
        </a>
    </li>
    <li class="nav-item">
        <a href="#BillingTab" data-toggle="tab" role="tab" class="nav-link">
            @L("Invoice")
        </a>
    </li>
    <li class="nav-item">
        <a href="#OtherSettingsTab" data-toggle="tab" role="tab" class="nav-link">
            @L("OtherSettings")
        </a>
    </li>
    @if (Model.EnabledSocialLoginSettings.Any())
    {
        <li class="nav-item">
            <a href="#ExternalLoginSettingsTab" aria-expanded="true" class="nav-link" data-toggle="tab" role="tab">
                @L("ExternalLoginSettings")
            </a>
        </li>
    }
</ul>

<div class="tab-content m-5">
@if (Clock.SupportsMultipleTimezone)
{
    <div class="tab-pane active" id="SettingsGeneralTab">
        <form id="GeneralSettingsForm">
            <div class="form-group ">
                <label for="Timezone">@L("Timezone")</label>
                @Html.DropDownList("Timezone", Model.TimezoneItems.Select(i => i.ToSelectListItem()), new {@class = "form-control edited", id = "Timezone"})
            </div>
            <div>
                @Html.Hidden("TimezoneForComparison", Model.Settings.General.TimezoneForComparison)
            </div>
        </form>
    </div>
}

<div class="tab-pane  @((!Clock.SupportsMultipleTimezone) ? "active" : "")" id="SettingsTenantManagementTab">

    <form id="TenantManagementSettingsForm">
        <h5>@L("FormBasedRegistration")</h5>
        <div class="form-group">
            <label for="Setting_AllowSelfRegistration" class="checkbox checkbox-outline col-lg-12">
                <input id="Setting_AllowSelfRegistration" type="checkbox" name="AllowSelfRegistration" value="true" @(Model.Settings.TenantManagement.AllowSelfRegistration ? "checked=\"checked\"" : "")>
                <span></span>
                @L("AllowTenantsToRegisterThemselves")
            </label>
            <span class="form-text text-muted">@L("AllowTenantsToRegisterThemselves_Hint")</span>
        </div>
        <div class="form-group">
            <label for="Setting_IsNewRegisteredTenantActiveByDefault" class="checkbox checkbox-outline col-lg-12">
                <input id="Setting_IsNewRegisteredTenantActiveByDefault" type="checkbox" name="IsNewRegisteredTenantActiveByDefault" value="true" @(Model.Settings.TenantManagement.IsNewRegisteredTenantActiveByDefault ? "checked=\"checked\"" : "")>
                <span></span>
                @L("NewRegisteredTenantsIsActiveByDefault")
            </label>
            <span class="form-text text-muted">@L("NewRegisteredTenantsIsActiveByDefault_Hint")</span>
        </div>
        <div class="form-group">
            <label for="Setting_UseCaptchaOnRegistration" class="checkbox checkbox-outline col-lg-12">
                <input id="Setting_UseCaptchaOnRegistration" type="checkbox" name="UseCaptchaOnRegistration" value="true" @(Model.Settings.TenantManagement.UseCaptchaOnRegistration ? "checked=\"checked\"" : "")>
                <span></span>
                @L("UseCaptchaOnRegistration")
            </label>
        </div>
        <div class="form-group">
            <label for="DefaultEditionId">@L("Edition")</label>
            @Html.DropDownList("DefaultEditionId", Model.EditionItems.Select(i => i.ToSelectListItem()), new {@class = "form-control edited", id = "DefaultEditionId"})
        </div>
    </form>
</div>

<div class="tab-pane" id="SettingsUserManagementTab">
    <form id="UserManagementSettingsForm">
        <div class="checkbox-list">
            <label for="Settings_IsEmailConfirmationRequiredForLogin" class="checkbox checkbox-outline">
                <input id="Settings_IsEmailConfirmationRequiredForLogin" type="checkbox" name="IsEmailConfirmationRequiredForLogin" value="true" @(Model.Settings.UserManagement.IsEmailConfirmationRequiredForLogin ? "checked=\"checked\"" : "")>
                <span></span>
                @L("EmailConfirmationRequiredForLogin")
            </label>
            <label for="Settings_SmsVerificationEnabled" class="checkbox checkbox-outline">
                <input id="Settings_SmsVerificationEnabled" type="checkbox" name="SmsVerificationEnabled" value="true" @(Model.Settings.UserManagement.SmsVerificationEnabled ? "checked=\"checked\"" : "")>
                <span></span>
                @L("SmsVerificationEnabled")
            </label>
            <label for="Setting_UseCaptchaOnLogin" class="checkbox checkbox-outline">
                <input id="Setting_UseCaptchaOnLogin" type="checkbox" name="UseCaptchaOnLogin" value="true" @(Model.Settings.UserManagement.UseCaptchaOnLogin ? "checked=\"checked\"" : "")>
                <span></span>
                @L("UseCaptchaOnLogin")
            </label>
            <h5>@L("CookieConsent")</h5>
            <label for="Setting_IsCookieConsentEnabled" class="checkbox checkbox-outline">
                <input id="Setting_IsCookieConsentEnabled" type="checkbox" name="IsCookieConsentEnabled" value="true" @(Model.Settings.UserManagement.IsCookieConsentEnabled ? "checked=\"checked\"" : "")>
                <span></span>
                @L("IsCookieConsentEnabled")
            </label>
            <h5>@L("SessionTimeOut")</h5>
            <label for="Setting_IsSessionTimeOutEnabled" class="checkbox checkbox-outline">
                <input id="Setting_IsSessionTimeOutEnabled" type="checkbox" name="IsEnabled" value="true" @(Model.Settings.UserManagement.SessionTimeOutSettings.IsEnabled ? "checked=\"checked\"" : "")>
                <span></span>
                @L("IsSessionTimeOutEnabled")
            </label>
            <div class="divSessionTimeOut">
                <label for="Setting_ShowLockScreenWhenTimedOut" class="checkbox checkbox-outline">
                    <input id="Setting_ShowLockScreenWhenTimedOut" type="checkbox" name="ShowLockScreenWhenTimedOut" value="true" @(Model.Settings.UserManagement.SessionTimeOutSettings.ShowLockScreenWhenTimedOut ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("ShowLockScreenWhenTimedOut")
                </label>
                <div class="form-group">
                    <label for="Setting_SessionTimeOutSecond">@L("SessionTimeOutSecond")</label>
                    <input id="Setting_SessionTimeOutSecond" type="number" name="TimeOutSecond" class="form-control edited" min="10" value="@Model.Settings.UserManagement.SessionTimeOutSettings.TimeOutSecond">
                </div>
                <div class="form-group">
                    <label for="Setting_ShowTimeOutNotificationSecond">@L("ShowTimeOutNotificationSecond")</label>
                    <input id="Setting_ShowTimeOutNotificationSecond" type="number" name="ShowTimeOutNotificationSecond" class="form-control edited" min="10" value="@Model.Settings.UserManagement.SessionTimeOutSettings.ShowTimeOutNotificationSecond">
                </div>
            </div>
            <h5>@L("Profile")</h5>
            <label for="Setting_AllowUsingGravatarProfilePicture" class="checkbox checkbox-outline">
                <input id="Setting_AllowUsingGravatarProfilePicture" type="checkbox" name="AllowUsingGravatarProfilePicture" value="true" @(Model.Settings.UserManagement.AllowUsingGravatarProfilePicture ? "checked=\"checked\"" : "")>
                <span></span>
                @L("AllowUsingGravatarProfilePicture")
            </label>
        </div>
    </form>
</div>

<div id="SecurityManagementTab" class="tab-pane">
    <div>
        <h5>@L("PasswordComplexity")</h5>
        <label for="Setting_PasswordComplexity_UseDefaultSettings" class="checkbox checkbox-outline">
            <input id="Setting_PasswordComplexity_UseDefaultSettings" type="checkbox" name="UseDefaultSettings" value="true" @(Model.Settings.Security.UseDefaultPasswordComplexitySettings ? "checked=\"checked\"" : "")>
            <span></span>
            @L("UseDefaultSettings")
        </label>
        <form class="p-5" id="PasswordComplexitySettingsForm" style="@(Model.Settings.Security.UseDefaultPasswordComplexitySettings ? "display:none;" : "")">
            <div class="checkbox-list">
                <label for="Setting_PasswordComplexity_RequireDigit" class="checkbox checkbox-outline">
                    <input id="Setting_PasswordComplexity_RequireDigit" type="checkbox" name="RequireDigit" value="true" @(Model.Settings.Security.PasswordComplexity.RequireDigit ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("PasswordComplexity_RequireDigit")
                </label>
                <label for="Setting_PasswordComplexity_RequireLowercase" class="checkbox checkbox-outline">
                    <input id="Setting_PasswordComplexity_RequireLowercase" type="checkbox" name="RequireLowercase" value="true" @(Model.Settings.Security.PasswordComplexity.RequireLowercase ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("PasswordComplexity_RequireLowercase")
                </label>
                <label for="Setting_PasswordComplexity_RequireNonAlphanumeric" class="checkbox checkbox-outline">
                    <input id="Setting_PasswordComplexity_RequireNonAlphanumeric" type="checkbox" name="RequireNonAlphanumeric" value="true" @(Model.Settings.Security.PasswordComplexity.RequireNonAlphanumeric ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("PasswordComplexity_RequireNonAlphanumeric")
                </label>
                <label for="Setting_PasswordComplexity_RequireUppercase" class="checkbox checkbox-outline">
                    <input id="Setting_PasswordComplexity_RequireUppercase" type="checkbox" name="RequireUppercase" value="true" @(Model.Settings.Security.PasswordComplexity.RequireUppercase ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("PasswordComplexity_RequireUppercase")
                </label>
            </div>
            <div class="form-group mt-3">
                <label>@L("PasswordComplexity_RequiredLength")</label>
                <input type="number" name="RequiredLength" class="form-control edited" value="@Model.Settings.Security.PasswordComplexity.RequiredLength">
            </div>
        </form>
        <form class="p-5" id="DefaultPasswordComplexitySettingsForm" style="@(!Model.Settings.Security.UseDefaultPasswordComplexitySettings ? "display:none;" : "")">
            <div class="checkbox-list">
                <label for="Setting_DefaultPasswordComplexity_RequireDigit" class="checkbox checkbox-outline">
                    <input id="Setting_DefaultPasswordComplexity_RequireDigit" type="checkbox" name="RequireDigit" value="true" @(Model.Settings.Security.DefaultPasswordComplexity.RequireDigit ? "checked=\"checked\"" : "") disabled>
                    <span></span>
                    @L("PasswordComplexity_RequireDigit")
                </label>
                <label for="Setting_DefaultPasswordComplexity_RequireLowercase" class="checkbox checkbox-outline">
                    <input id="Setting_DefaultPasswordComplexity_RequireLowercase" type="checkbox" name="RequireLowercase" value="true" @(Model.Settings.Security.DefaultPasswordComplexity.RequireLowercase ? "checked=\"checked\"" : "") disabled>
                    <span></span>
                    @L("PasswordComplexity_RequireLowercase")
                </label>
                <label for="Setting_DefaultPasswordComplexity_RequireNonAlphanumeric" class="checkbox checkbox-outline">
                    <input id="Setting_DefaultPasswordComplexity_RequireNonAlphanumeric" type="checkbox" name="RequireNonAlphanumeric" value="true" @(Model.Settings.Security.DefaultPasswordComplexity.RequireNonAlphanumeric ? "checked=\"checked\"" : "") disabled>
                    <span></span>
                    @L("PasswordComplexity_RequireNonAlphanumeric")
                </label>
                <label for="Setting_DefaultPasswordComplexity_RequireUppercase" class="checkbox checkbox-outline">
                    <input id="Setting_DefaultPasswordComplexity_RequireUppercase" type="checkbox" name="RequireUppercase" value="true" @(Model.Settings.Security.DefaultPasswordComplexity.RequireUppercase ? "checked=\"checked\"" : "") disabled>
                    <span></span>
                    @L("PasswordComplexity_RequireUppercase")
                </label>
            </div>
            <div class="form-group mt-3">
                <label for="RequiredLength">@L("PasswordComplexity_RequiredLength")</label>
                <input id="RequiredLength" type="number" name="RequiredLength" class="form-control edited" value="@Model.Settings.Security.DefaultPasswordComplexity.RequiredLength" disabled>
            </div>
        </form>
    </div>

    <div>
        <h5>@L("UserLockOut")</h5>
        <form id="UserLockOutSettingsForm">
            <label for="Setting_UserLockOut_IsEnabled" class="checkbox checkbox-outline">
                <input id="Setting_UserLockOut_IsEnabled" type="checkbox" name="IsEnabled" value="true" @(Model.Settings.Security.UserLockOut.IsEnabled ? "checked=\"checked\"" : "")>
                <span></span>
                @L("EnableUserAccountLockingOnFailedLoginAttemts")
            </label>
            <div class="form-group">
                <label for="MaxFailedAccessAttemptsBeforeLockout">@L("MaxFailedAccessAttemptsBeforeLockout")</label>
                <input id="MaxFailedAccessAttemptsBeforeLockout" type="number" name="MaxFailedAccessAttemptsBeforeLockout" class="form-control edited" value="@Model.Settings.Security.UserLockOut.MaxFailedAccessAttemptsBeforeLockout">
            </div>
            <div class="form-group">
                <label for="DefaultAccountLockoutSeconds">@L("DefaultAccountLockoutDurationAsSeconds")</label>
                <input id="DefaultAccountLockoutSeconds" type="number" name="DefaultAccountLockoutSeconds" class="form-control edited" value="@Model.Settings.Security.UserLockOut.DefaultAccountLockoutSeconds">
            </div>
        </form>
    </div>

    <div>
        <h5>@L("TwoFactorLogin")</h5>
        <form id="TwoFactorLoginSettingsForm">
            <div class="checkbox-list">
                <label for="Setting_TwoFactorLogin_IsEnabled" class="checkbox checkbox-outline">
                    <input id="Setting_TwoFactorLogin_IsEnabled" type="checkbox" name="IsEnabled" value="true" @(Model.Settings.Security.TwoFactorLogin.IsEnabled ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("EnableTwoFactorLogin")
                </label>
                <label for="Setting_TwoFactorLogin_IsEmailProviderEnabled" class="checkbox checkbox-outline">
                    <input id="Setting_TwoFactorLogin_IsEmailProviderEnabled" type="checkbox" name="IsEmailProviderEnabled" value="true" @(Model.Settings.Security.TwoFactorLogin.IsEmailProviderEnabled ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("IsEmailVerificationEnabled")
                </label>
                <label for="Setting_TwoFactorLogin_IsSmsProviderEnabled" class="checkbox checkbox-outline">
                    <input id="Setting_TwoFactorLogin_IsSmsProviderEnabled" type="checkbox" name="IsSmsProviderEnabled" value="true" @(Model.Settings.Security.TwoFactorLogin.IsSmsProviderEnabled ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("IsSmsVerificationEnabled")
                </label>
                <label for="Setting_TwoFactorLogin_IsGoogleAuthenticatorEnabled" class="checkbox checkbox-outline">
                    <input id="Setting_TwoFactorLogin_IsGoogleAuthenticatorEnabled" type="checkbox" name="IsGoogleAuthenticatorEnabled" value="true" @(Model.Settings.Security.TwoFactorLogin.IsGoogleAuthenticatorEnabled ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("IsGoogleAuthenticatorEnabled")
                </label>
                <label for="Setting_TwoFactorLogin_IsRememberBrowserEnabled" class="checkbox checkbox-outline">
                    <input id="Setting_TwoFactorLogin_IsRememberBrowserEnabled" type="checkbox" name="IsRememberBrowserEnabled" value="true" @(Model.Settings.Security.TwoFactorLogin.IsRememberBrowserEnabled ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("AllowToRememberBrowserForTwoFactorLogin")
                </label>
            </div>
        </form>
    </div>
    <div>
        <h5>@L("OneConcurrentLoginPerUser")</h5>
        <form id="OneConcurrentLoginPerUser">
            <div class="checkbox-list">
                <label for="Setting_AllowOneConcurrentLoginPerUser" class="checkbox checkbox-outline">
                    <input id="Setting_AllowOneConcurrentLoginPerUser" type="checkbox" name="Setting_AllowOneConcurrentLoginPerUser" value="true" @(Model.Settings.Security.AllowOneConcurrentLoginPerUser ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("OneConcurrentLoginPerUserActive")
                </label>
            </div>
        </form>
    </div>
</div>

<div class="tab-pane" id="SettingsEmailSmtpTab">
    <form id="EmailSmtpSettingsForm">
        <div class="form-group">
            <label for="DefaultFromAddress">@L("DefaultFromAddress")</label>
            <input id="DefaultFromAddress" type="email" name="DefaultFromAddress" class="form-control@(Model.Settings.Email.DefaultFromAddress.IsNullOrEmpty() ? "" : " edited")" value="@Model.Settings.Email.DefaultFromAddress" maxlength="@Mes5GService.Authorization.Users.User.MaxEmailAddressLength">
        </div>

        <div class="form-group">
            <label for="DefaultFromDisplayName">@L("DefaultFromDisplayName")</label>
            <input id="DefaultFromDisplayName" type="text" name="DefaultFromDisplayName" class="form-control@(Model.Settings.Email.DefaultFromDisplayName.IsNullOrEmpty() ? "" : " edited")" value="@Model.Settings.Email.DefaultFromDisplayName" maxlength="128">
        </div>

        <div class="form-group ">
            <label for="SmtpHost">@L("SmtpHost")</label>
            <input id="SmtpHost" type="text" name="SmtpHost" class="form-control@(Model.Settings.Email.SmtpHost.IsNullOrEmpty() ? "" : " edited")" value="@Model.Settings.Email.SmtpHost" maxlength="64">
        </div>

        <div class="form-group ">
            <label for="SmtpPort">@L("SmtpPort")</label>
            <input id="SmtpPort" type="number" name="SmtpPort" class="form-control edited" value="@Model.Settings.Email.SmtpPort" maxlength="5">
        </div>

        <div class="checkbox-list">
            <label for="Settings_SmtpEnableSsl" class="checkbox checkbox-outline">
                <input id="Settings_SmtpEnableSsl" type="checkbox" name="SmtpEnableSsl" value="true" @Html.Raw(Model.Settings.Email.SmtpEnableSsl ? "checked=\"checked\"" : "")>
                <span></span>
                @L("UseSsl")
            </label>
            <label for="Settings_SmtpUseDefaultCredentials" class="checkbox checkbox-outline">
                <input id="Settings_SmtpUseDefaultCredentials" type="checkbox" name="SmtpUseDefaultCredentials" value="true" @Html.Raw(Model.Settings.Email.SmtpUseDefaultCredentials ? "checked=\"checked\"" : "")>
                <span></span>
                @L("UseDefaultCredentials")
            </label>
        </div>

        <div class="form-group">
            <label for="SmtpDomain">@L("DomainName")</label>
            <input id="SmtpDomain" type="text" name="SmtpDomain" class="form-control@(Model.Settings.Email.SmtpDomain.IsNullOrEmpty() ? "" : " edited")" value="@Model.Settings.Email.SmtpDomain" maxlength="128">
        </div>

        <div class="form-group">
            <label for="SmtpUserName">@L("UserName")</label>
            <input id="SmtpUserName" type="text" name="SmtpUserName" class="form-control@(Model.Settings.Email.SmtpUserName.IsNullOrEmpty() ? "" : " edited")" value="@Model.Settings.Email.SmtpUserName" maxlength="128">
        </div>

        <div class="form-group">
            <label for="SmtpPassword">@L("Password")</label>
            <input id="SmtpPassword" type="password" name="SmtpPassword" class="form-control@(Model.Settings.Email.SmtpPassword.IsNullOrEmpty() ? "" : " edited")" value="@Model.Settings.Email.SmtpPassword" maxlength="128" autocomplete="new-password">
        </div>

        <hr/>

        <h4>@L("TestEmailSettingsHeader")</h4>

        <div class="row">
            <div class="form-group  col-md-4">
                <input id="TestEmailAddressInput" type="text" class="form-control input-sm" value="@ViewBag.CurrentUserEmail">
            </div>
            <div class="form-group col-md-2">
                <button id="SendTestEmailButton" class="btn btn-primary" type="button">@L("SendTestEmail")</button>
            </div>
        </div>
    </form>
</div>

<div class="tab-pane" id="BillingTab">
    <form id="BillingSettingsForm" class="form">
        <div class="form-group">
            <label for="LegalName">@L("LegalName")</label>
            <input id="LegalName" type="text" name="LegalName" class="form-control" value="@Model.Settings.Billing.LegalName" maxlength="64">
        </div>

        <div class="form-group">
            <label for="Address">@L("Address")</label>
            <textarea id="Address" rows="5" name="Address" class="form-control" maxlength="256">@Model.Settings.Billing.Address</textarea>
        </div>
    </form>
</div>

<div class="tab-pane" id="OtherSettingsTab">
    <form id="OtherSettingsForm" class="form">
        <div class="checkbox-list">
            <h5>@L("QuickThemeSelection")</h5>
            <label for="Setting_IsQuickThemeSelectEnabled" class="checkbox checkbox-outline">
                <input id="Setting_IsQuickThemeSelectEnabled" type="checkbox" name="IsQuickThemeSelectEnabled" value="true" @(Model.Settings.UserManagement.IsQuickThemeSelectEnabled ? "checked=\"checked\"" : "")>
                <span></span>
                @L("IsQuickThemeSelectEnabled")
            </label>
        </div>
    </form>
</div>
@if (Model.EnabledSocialLoginSettings.Any())
{
    <div class="tab-pane" id="ExternalLoginSettingsTab">
        @if (Model.EnabledSocialLoginSettings.Contains("Facebook"))
        {
            <form id="ExternalLoginFacebookSettingsForm" class="form">
                <h5>Facebook</h5>
                <div class="form-group">
                    <label for="Setting_Facebook_AppId">@L("AppId")*</label>
                    <input id="Setting_Facebook_AppId" type="text" class="form-control" name="AppId" value="@Model.Settings.ExternalLoginProviderSettings.Facebook.AppId">
                </div>
                <div class="form-group">
                    <label for="Setting_Facebook_AppSecret">@L("AppSecret")*</label>
                    <div class="input-group">
                        <input id="Setting_Facebook_AppSecret" type="password" class="form-control" name="AppSecret" value="@Model.Settings.ExternalLoginProviderSettings.Facebook.AppSecret">
                        <div class="input-group-append">
                            <button class="btn btn-primary passwordShowButton" type="button" data-id="Setting_Facebook_AppSecret">
                                <i class="far fa-eye text-white"></i> <span> @L("Show")</span>
                            </button>
                        </div>
                    </div>
                </div>
            </form>
        }

        @if (Model.EnabledSocialLoginSettings.Contains("Google"))
        {
            <form id="ExternalLoginGoogleSettingsForm" class="form">
                <h5>Google</h5>
                <div class="form-group">
                    <label for="Setting_Google_ClientId">@L("ClientId")*</label>
                    <input id="Setting_Google_ClientId" type="text" class="form-control" name="ClientId" value="@Model.Settings.ExternalLoginProviderSettings.Google.ClientId">
                </div>
                <div class="form-group">
                    <label for="Setting_Google_ClientSecret">@L("ClientSecret")*</label>
                    <div class="input-group">
                        <input id="Setting_Google_ClientSecret" type="password" class="form-control" name="ClientSecret" value="@Model.Settings.ExternalLoginProviderSettings.Google.ClientSecret">
                        <div class="input-group-append">
                            <button class="btn btn-primary passwordShowButton" type="button" data-id="Setting_Google_ClientSecret">
                                <i class="far fa-eye text-white"></i> <span> @L("Show")</span>
                            </button>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="Setting_Google_UserInfoEndpoint">@L("UserInfoEndpoint")</label>
                    <input id="Setting_Google_UserInfoEndpoint" type="text" class="form-control" name="UserInfoEndpoint" value="@Model.Settings.ExternalLoginProviderSettings.Google.UserInfoEndpoint">
                </div>
            </form>
        }

        @if (Model.EnabledSocialLoginSettings.Contains("Twitter"))
        {
            <form id="ExternalLoginTwitterSettingsForm" class="form">
                <h5>Twitter</h5>
                <div class="form-group">
                    <label for="Setting_Twitter_ConsumerKey">@L("ConsumerKey")*</label>
                    <input id="Setting_Twitter_ConsumerKey" type="text" class="form-control" name="ConsumerKey" value="@Model.Settings.ExternalLoginProviderSettings.Twitter.ConsumerKey">
                </div>
                <div class="form-group">
                    <label for="Setting_Twitter_ConsumerSecret">@L("ConsumerSecret")*</label>
                    <div class="input-group">
                        <input id="Setting_Twitter_ConsumerSecret" type="password" class="form-control" name="ConsumerSecret" value="@Model.Settings.ExternalLoginProviderSettings.Twitter.ConsumerSecret">
                        <div class="input-group-append">
                            <button class="btn btn-primary passwordShowButton" type="button" data-id="Setting_Twitter_ConsumerSecret">
                                <i class="far fa-eye text-white"></i> <span> @L("Show")</span>
                            </button>
                        </div>
                    </div>
                </div>
            </form>
        }

        @if (Model.EnabledSocialLoginSettings.Contains("Microsoft"))
        {
            <form id="ExternalLoginMicrosoftSettingsForm" class="form">
                <h5>Microsoft</h5>
                <div class="form-group">
                    <label for="Setting_Microsoft_ClientId">@L("ClientId")*</label>
                    <input id="Setting_Microsoft_ClientId" type="text" class="form-control" name="ClientId" value="@Model.Settings.ExternalLoginProviderSettings.Microsoft.ClientId">
                </div>
                <div class="form-group">
                    <label for="Setting_Microsoft_ClientSecret">@L("ClientSecret")*</label>
                    <div class="input-group">
                        <input id="Setting_Microsoft_ClientSecret" type="password" class="form-control" name="ClientSecret" value="@Model.Settings.ExternalLoginProviderSettings.Microsoft.ClientSecret">
                        <div class="input-group-append">
                            <button class="btn btn-primary passwordShowButton" type="button" data-id="Setting_Microsoft_ClientSecret">
                                <i class="far fa-eye text-white"></i> <span> @L("Show")</span>
                            </button>
                        </div>
                    </div>
                </div>
            </form>
        }
        @if (Model.EnabledSocialLoginSettings.Contains("OpenId"))
        {
            <hr>
            <form id="ExternalLoginOpenIdConnectSettingsForm" class="form">
                <h5>OpenID Connect</h5>
                <div class="form-group">
                    <label for="Setting_OpenIdConnect_ClientId">@L("ClientId")*</label>
                    <input id="Setting_OpenIdConnect_ClientId" type="text" class="form-control" name="ClientId" value="@Model.Settings.ExternalLoginProviderSettings.OpenIdConnect.ClientId">
                </div>
                <div class="form-group">
                    <label for="Setting_OpenIdConnect_ClientSecret">@L("ClientSecret")</label>
                    <div class="input-group">
                        <input id="Setting_OpenIdConnect_ClientSecret" type="password" class="form-control" name="ClientSecret" value="@Model.Settings.ExternalLoginProviderSettings.OpenIdConnect.ClientSecret">
                        <div class="input-group-append">
                            <button class="btn btn-primary passwordShowButton" type="button" data-id="Setting_OpenIdConnect_ClientSecret">
                                <i class="far fa-eye text-white"></i> <span> @L("Show")</span>
                            </button>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="Setting_OpenIdConnect_Authority">@L("Authority")*</label>
                    <input id="Setting_OpenIdConnect_Authority" type="text" class="form-control" name="Authority" value="@Model.Settings.ExternalLoginProviderSettings.OpenIdConnect.Authority">
                </div>
                <label for="Setting_OpenIdConnect_ValidateIssuer" class="checkbox checkbox-outline">
                    <input id="Setting_OpenIdConnect_ValidateIssuer" type="checkbox" name="OpenIdConnect_ValidateIssuer" value="true"
                           @(Model.Settings.ExternalLoginProviderSettings.OpenIdConnect.ValidateIssuer ? "checked=\"checked\"" : "")>
                    <span></span>
                    @L("ValidateIssuer")
                </label>

                <div class="form-group col-12">
                    <label>@L("ClaimsMapping")</label>
                    <div id="claimsMappingsContainer"></div>
                </div>
            </form>
        }
        @if (Model.EnabledSocialLoginSettings.Contains("WsFederation"))
        {
            <hr>
            <form id="ExternalLoginWsFederationSettingsForm" class="form">
                <div class="accordion">
                    <h5>WsFederation</h5>
                    <div class="form-group">
                        <label for="Setting_WsFederation_ClientId">@L("ClientId")</label>
                        <input id="Setting_WsFederation_ClientId" type="text" class="form-control" name="ClientId" value="@Model.Settings.ExternalLoginProviderSettings.WsFederation.ClientId">
                    </div>
                    <div class="form-group">
                        <label for="Setting_WsFederation_Tenant">@L("Tenant")</label>
                        <input id="Setting_WsFederation_Tenant" type="text" class="form-control" name="Tenant" value="@Model.Settings.ExternalLoginProviderSettings.WsFederation.Tenant">
                    </div>
                    <div class="form-group">
                        <label for="Setting_WsFederation_MetaDataAddress">@L("MetaDataAddress")</label>
                        <input id="Setting_WsFederation_MetaDataAddress" type="text" class="form-control" name="MetaDataAddress" value="@Model.Settings.ExternalLoginProviderSettings.WsFederation.MetaDataAddress">
                    </div>
                    <div class="form-group">
                        <label for="Setting_WsFederation_Wtrealm">@L("Wtrealm")</label>
                        <input id="Setting_WsFederation_Wtrealm" type="text" class="form-control" name="Wtrealm" value="@Model.Settings.ExternalLoginProviderSettings.WsFederation.Wtrealm">
                    </div>
                    <div class="form-group">
                        <label for="Setting_WsFederation_Authority">@L("Authority")</label>
                        <input id="Setting_WsFederation_Authority" type="text" class="form-control" name="Authority" value="@Model.Settings.ExternalLoginProviderSettings.WsFederation.Authority">
                    </div>

                    <div class="form-group col-12">
                        <label>@L("ClaimsMapping")</label>
                        <div id="Setting_WsFederation_ClaimsMappingsContainer"></div>
                    </div>
                </div>
            </form>
        }
    </div>
}
</div>
</div>
</div>
</div>
</div>
</div>
